home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / Level 1 Extensions 29Sep94 / DataMunging.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  3.0 KB  |  80 lines  |  [TEXT/KAHL]

  1. /* DataMunging.h */
  2.  
  3. #ifndef Included_DataMunging_h
  4. #define Included_DataMunging_h
  5.  
  6. /* DataMunging module depends on: */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Memory */
  12.  
  13. #include "Definitions.h"
  14.  
  15. /* Make a copy of the supplied Ptr.  If there is not enough memory to copy */
  16. /* the Ptr, NIL is returned. */
  17. char*                    CopyPtr(char* ThePtr);
  18.  
  19. /* return the length of a null-terminated string */
  20. long                    StrLen(char* String);
  21.  
  22. /* make a new copy of the Ptr containing a null-terminated string.  The */
  23. /* returned Ptr will NOT contain a null at the end.  Returns NIL if the */
  24. /* routine failed */
  25. char*                    StringToBlockCopy(char* String);
  26.  
  27. /* Make a copy of the specified block Ptr, appending a null to the end */
  28. /* to make it into a null-terminated string.  Returns NIL if it failed */
  29. char*                    BlockToStringCopy(char* Block);
  30.  
  31. /* allocate a block and copy the raw data to it.  Returns NIL if it failed. */
  32. char*                    BlockFromRaw(char* Data, long Length);
  33.  
  34. /* allocate a block and copy the null-terminated string (including the null) */
  35. /* to it.  Returns NIL if the routine failed. */
  36. char*                    StringFromRaw(char* Data);
  37.  
  38. /* allocate a copy of the specified Ptr, appending the character at the end */
  39. /* returns NIL if the routine failed */
  40. char*                    AppendCharToBlockCopy(char* ThePtr, char TheChar);
  41.  
  42. /* compare memory ranges and return True if they are equal or False if not. */
  43. MyBoolean            MemEqu(char* Left, char* Right, long NumBytes);
  44.  
  45. /* compare memory ranges, but treat uppercase and lowercase letters as equal */
  46. MyBoolean            MemEquNoCase(char* First, char* Second, long NumBytes);
  47.  
  48. /* return true if the null terminated strings are equal, or false if not */
  49. MyBoolean            StrEqu(char* Left, char* Right);
  50.  
  51. /* insert the specified block of raw data into the Ptr and return the new copy */
  52. /* returns NIL if the routine failed */
  53. char*                    InsertBlockIntoBlockCopy(char* Block, char* NewData,
  54.                                 long Where, long Length);
  55.  
  56. /* remove the specified area from the Ptr and return the copy or NIL if it failed */
  57. char*                    RemoveBlockFromBlockCopy(char* Block, long Where, long Length);
  58.  
  59. /* identical to InsertBlockIntoBlockCopy but allows element size to be specified */
  60. char*                    InsertEntryIntoArrayCopy(char* Array, char* NewEntry,
  61.                                 long Where, long ElementSize);
  62.  
  63. /* Identical to RemoveBlockFromBlockCopy but allows element size to be specified */
  64. char*                    RemoveEntryFromArrayCopy(char* Array, long EntryIndex, long ElementSize);
  65.  
  66. /* search for the first occurrence of Key in Block and replace the data with */
  67. /* Replacement, returning a copy of the data or NIL if it failed */
  68. char*                    ReplaceBlockCopy(char* Block, char* Key, char* Replacement);
  69.  
  70. /* concatenate two blocks, returning the new block or NIL if it failed */
  71. char*                    ConcatBlockCopy(char* Left, char* Right);
  72.  
  73. /* return a middle section of the block or NIL if it failed */
  74. char*                    MidBlockCopy(char* Block, long Start, long NumChars);
  75.  
  76. /* return a block from which a section has been stripped, or NIL if it failed. */
  77. char*                    ReduceBlockCopy(char* Block, long Start, long NumChars);
  78.  
  79. #endif
  80.